package com.keyue.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.keyue.common.constant.Constant;
import com.keyue.common.jsr303.OperateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;


@SuperBuilder(toBuilder = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BasePageVO {

    /**
     * 页码
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotNull(message = "页码不能为空", groups = {OperateGroup.List.class})
    @Min(value = Constant.ONE, message = "页码不能小于1", groups = {OperateGroup.List.class})
    private Integer page = 1;
    /**
     * 页
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotNull(message = "每页大小不能为空", groups = {OperateGroup.List.class})
    @Min(value = 1, message = "每页大小不能小于1", groups = {OperateGroup.List.class})
    @Max(value = 5000, message = "每页大小不能大于5000", groups = {OperateGroup.List.class})
    private Integer pageSize = 10;

    /**
     * 总数
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer total;
}
